package com.tcm.day05;

import java.util.Comparator;
import java.util.PriorityQueue;

public class Code03_PriorityQueue {

    public static class Student{
        int id;
        String name;
        int age;

        public Student(int id, String name, int age) {
            this.id = id;
            this.name = name;
            this.age = age;
        }
    }

    public static void main(String[] args) {

        PriorityQueue<Student> queue = new PriorityQueue(new Comparator<Student>() {
            // 返回-1，第一个数排在第二个数前面
            // 返回1，第二个数排在第一个数前面
            @Override
            public int compare(Student s1, Student s2) {
                if(s1.id < s2.id) {
                    return -1;
                }else if(s1.id > s2.id){
                    return 1;
                }else {
                    return 0;
                }
            }
        });

    }

}
